package cn.wolfcode.luowowo.article.service.impl;

import cn.wolfcode.luowowo.article.domain.Scene;
import cn.wolfcode.luowowo.article.mapper.SceneMapper;
import cn.wolfcode.luowowo.article.query.SceneQuery;
import cn.wolfcode.luowowo.article.service.ISceneService;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class SceneServiceImpl implements ISceneService {
    @Autowired
    private SceneMapper sceneMapper;
    @Override
    public List<Scene> selectHotTop5(Long DestId) {
        List<Scene> top5 = sceneMapper.selectHotTop5(DestId);
        return top5;
    }

    @Override
    public PageInfo<Scene> query(SceneQuery qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        return new PageInfo(sceneMapper.selectForList(qo));
    }

    @Override
    public Scene selectDestBysurvey(Long destId) {
        return sceneMapper.selectDestBysurvey(destId);
    }

    @Override
    public List<Scene> selectTop10() {
        return sceneMapper.selectTop10();
    }

    @Override
    public Scene selectScene(Long id) {

        return sceneMapper.selectScene(id);
    }

    @Override
    public List<Scene> selectListByScene(Long parentId) {
        return sceneMapper.selectListByScene(parentId);
    }

    @Override
    public List<Scene> list() {
        return sceneMapper.selectAll();
    }

    public List<Scene> selectByUserId(Long id) {
        return sceneMapper.selectByUserId(id);
    }
}
